package com.itheima.api;

import java.math.BigDecimal;
import java.sql.SQLOutput;
import java.util.Scanner;

public class Demo3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输如第一个运算的数:");
            String num = sc.next();
            BigDecimal numbig = new BigDecimal(num);
            System.out.println("请输入第二个运算的数:");
            String num1 = sc.next();
            BigDecimal num1big = new BigDecimal(num1);
            System.out.println("请输入您要进行的运算:[0:退出 1:加法 2:减法 3:乘法 4:除法]");
            String choic = sc.next();
            switch (choic) {
                case "0":
                    return;

                case "1":
                    System.out.println(num + "+" + num1 + "=" + (num1big.add(numbig)));
                    break;
                case "2":
                    System.out.println(num + "-" + num1 + "=" + (numbig.subtract(num1big)));
                    break;
                case "3":
                    System.out.println(num + "*" + num1 + "=" + (num1big.multiply(numbig)));
                    break;
                case "4":
                    System.out.println(num + "/" + num1 + "=" + (numbig.divide(num1big)));
                    break;
                default:
                    System.out.println("您的输入有误");
            }
        }
    }
}
